import * as path from "path";
import { loopItems } from "./arrLike";
export namespace NS_Path {
    export interface ShowNameInfo {
        isLib: boolean;
        name: string;
        originName: string;
    };
}
export function getBaseName(fullName: string) {
    return path.basename(fullName);
}

export function getShowNameInfo(fullName: string): NS_Path.ShowNameInfo {
    let baseName = getBaseName(fullName);
    let libs = {
        "applications": "应用库",
        "application": "应用",
        "app": "应用",
        "projects": "项目库",
        "project": "项目",
        "program": "程序",
        "programs": "程序库",
        "library": "资源库",
        "lib": "资源库",
        "users": "用户",
        "jimmy": "赤羽",
        "pb-jimmy": "轻舟-赤羽",
        "shared": "分享",
        "software": "软件",
        "system": "系统",
    };
    let libKeys = Object.keys(libs);
    let zKey: string = '';
    loopItems(libKeys, libKey => {
        if (libKey === baseName.toLowerCase()) {
            zKey = libKey;
            return false;
        }
    });
    if (zKey) {
        return {
            isLib: true,
            name: libs[zKey],
            originName: baseName
        }
    }
    return {
        name: baseName,
        isLib: false,
        originName: baseName
    };
}